.TH "libalpm_packages" 3 "libalpm" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libalpm_packages \- Package Functions
.PP
 \- Functions to manipulate libalpm packages  

.SH SYNOPSIS
.br
.PP
.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBalpm_pkg_xdata_t\fP"
.br
.RI "The extended data type used to store non-standard package data fields\&. "
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef struct _alpm_pkg_t \fBalpm_pkg_t\fP"
.br
.RI "A package\&. "
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBalpm_pkgreason_t\fP { \fBALPM_PKG_REASON_EXPLICIT\fP = 0, \fBALPM_PKG_REASON_DEPEND\fP = 1, \fBALPM_PKG_REASON_UNKNOWN\fP = 2 }"
.br
.RI "Package install reasons\&. "
.ti -1c
.RI "enum \fBalpm_pkgfrom_t\fP { \fBALPM_PKG_FROM_FILE\fP = 1, \fBALPM_PKG_FROM_LOCALDB\fP, \fBALPM_PKG_FROM_SYNCDB\fP }"
.br
.RI "Location a package object was loaded from\&. "
.ti -1c
.RI "enum \fBalpm_pkgvalidation_t\fP { \fBALPM_PKG_VALIDATION_UNKNOWN\fP = 0, \fBALPM_PKG_VALIDATION_NONE\fP = (1 << 0), \fBALPM_PKG_VALIDATION_MD5SUM\fP = (1 << 1), \fBALPM_PKG_VALIDATION_SHA256SUM\fP = (1 << 2), \fBALPM_PKG_VALIDATION_SIGNATURE\fP = (1 << 3) }"
.br
.RI "Method used to validate a package\&. "
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBalpm_pkg_load\fP (\fBalpm_handle_t\fP *handle, const char *filename, int full, int level, \fBalpm_pkg_t\fP **pkg)"
.br
.RI "Create a package from a file\&. "
.ti -1c
.RI "int \fBalpm_fetch_pkgurl\fP (\fBalpm_handle_t\fP *handle, const \fBalpm_list_t\fP *urls, \fBalpm_list_t\fP **fetched)"
.br
.RI "Fetch a list of remote packages\&. "
.ti -1c
.RI "\fBalpm_pkg_t\fP * \fBalpm_pkg_find\fP (\fBalpm_list_t\fP *haystack, const char *needle)"
.br
.RI "Find a package in a list by name\&. "
.ti -1c
.RI "int \fBalpm_pkg_free\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Free a package\&. "
.ti -1c
.RI "int \fBalpm_pkg_checkmd5sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Check the integrity (with md5) of a package from the sync cache\&. "
.ti -1c
.RI "int \fBalpm_pkg_vercmp\fP (const char *a, const char *b)"
.br
.RI "Compare two version strings and determine which one is 'newer'\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_compute_requiredby\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Computes the list of packages requiring a given package\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_compute_optionalfor\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Computes the list of packages optionally requiring a given package\&. "
.ti -1c
.RI "int \fBalpm_pkg_should_ignore\fP (\fBalpm_handle_t\fP *handle, \fBalpm_pkg_t\fP *pkg)"
.br
.RI "Test if a package should be ignored\&. "
.in -1c
.SS "Package Property Accessors"
Any pointer returned by these functions points to internal structures allocated by libalpm\&.

.PP
They should not be freed nor modified in any way\&.

.PP
For loaded packages, they will be freed when \fBalpm_pkg_free\fP is called\&. For database packages, they will be freed when the database is unregistered\&. 
.in +1c
.ti -1c
.RI "\fBalpm_handle_t\fP * \fBalpm_pkg_get_handle\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Gets the handle of a package\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_filename\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Gets the name of the file from which the package was loaded\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_base\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package base name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_name\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_version\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package version as a string\&. "
.ti -1c
.RI "\fBalpm_pkgfrom_t\fP \fBalpm_pkg_get_origin\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the origin of the package\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_desc\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package description\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_url\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package URL\&. "
.ti -1c
.RI "\fBalpm_time_t\fP \fBalpm_pkg_get_builddate\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the build timestamp of the package\&. "
.ti -1c
.RI "\fBalpm_time_t\fP \fBalpm_pkg_get_installdate\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the install timestamp of the package\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_packager\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the packager's name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_md5sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package's MD5 checksum as a string\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_sha256sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package's SHA256 checksum as a string\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_arch\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the architecture for which the package was built\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_get_size\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the size of the package\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_get_isize\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the installed size of the package\&. "
.ti -1c
.RI "\fBalpm_pkgreason_t\fP \fBalpm_pkg_get_reason\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package installation reason\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_licenses\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package licenses\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_groups\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package groups\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_depends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package dependencies as \fBalpm_depend_t\fP\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_optdepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package optional dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_checkdepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns a list of package check dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_makedepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns a list of package make dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_conflicts\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages conflicting with pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_provides\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages provided by pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_replaces\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages to be replaced by pkg\&. "
.ti -1c
.RI "\fBalpm_filelist_t\fP * \fBalpm_pkg_get_files\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of files installed by pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_backup\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of files backed up when installing pkg\&. "
.ti -1c
.RI "\fBalpm_db_t\fP * \fBalpm_pkg_get_db\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the database containing pkg\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_base64_sig\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the base64 encoded package signature\&. "
.ti -1c
.RI "int \fBalpm_pkg_get_sig\fP (\fBalpm_pkg_t\fP *pkg, unsigned char **sig, size_t *sig_len)"
.br
.RI "Extracts package signature either from embedded package signature or if it is absent then reads data from detached signature file\&. "
.ti -1c
.RI "int \fBalpm_pkg_get_validation\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the method used to validate a package during install\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_xdata\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Gets the extended data field of a package\&. "
.ti -1c
.RI "int \fBalpm_pkg_has_scriptlet\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns whether the package has an install scriptlet\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_download_size\fP (\fBalpm_pkg_t\fP *newpkg)"
.br
.RI "Returns the size of the files that will be downloaded to install a package\&. "
.ti -1c
.RI "int \fBalpm_pkg_set_reason\fP (\fBalpm_pkg_t\fP *pkg, \fBalpm_pkgreason_t\fP reason)"
.br
.RI "Set install reason for a package in the local database\&. "
.in -1c
.SS "Changelog functions"
Functions for reading the changelog 
.in +1c
.ti -1c
.RI "void * \fBalpm_pkg_changelog_open\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Open a package changelog for reading\&. "
.ti -1c
.RI "size_t \fBalpm_pkg_changelog_read\fP (void *ptr, size_t size, const \fBalpm_pkg_t\fP *pkg, void *fp)"
.br
.RI "Read data from an open changelog 'file stream'\&. "
.ti -1c
.RI "int \fBalpm_pkg_changelog_close\fP (const \fBalpm_pkg_t\fP *pkg, void *fp)"
.br
.RI "Close a package changelog for reading\&. "
.in -1c
.SS "Mtree functions"
Functions for reading the mtree 
.in +1c
.ti -1c
.RI "struct archive * \fBalpm_pkg_mtree_open\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Open a package mtree file for reading\&. "
.ti -1c
.RI "int \fBalpm_pkg_mtree_next\fP (const \fBalpm_pkg_t\fP *pkg, struct archive *archive, struct archive_entry **entry)"
.br
.RI "Read next entry from a package mtree file\&. "
.ti -1c
.RI "int \fBalpm_pkg_mtree_close\fP (const \fBalpm_pkg_t\fP *pkg, struct archive *archive)"
.br
.RI "Close a package mtree file\&. "
.in -1c
.SH "Detailed Description"
.PP 
Functions to manipulate libalpm packages 


.SH "Data Structure Documentation"
.PP 
.SH "struct alpm_pkg_xdata_t"
.PP 
The extended data type used to store non-standard package data fields\&. 
.PP
\fBData Fields:\fP
.RS 4
char * \fIname\fP 
.br
.PP
char * \fIvalue\fP 
.br
.PP
.RE
.PP
.SH "Typedef Documentation"
.PP 
.SS "typedef struct _alpm_pkg_t \fBalpm_pkg_t\fP"

.PP
A package\&. A package can be loaded from disk via \fBalpm_pkg_load\fP or retrieved from a database\&. Packages from databases are automatically freed when the database is unregistered\&. Packages loaded from a file must be freed manually\&.

.PP
Packages can then be queried for metadata or added to a transaction to be added or removed from the system\&. 
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBalpm_pkgfrom_t\fP"

.PP
Location a package object was loaded from\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BIALPM_PKG_FROM_FILE \fP
Loaded from a file via \fBalpm_pkg_load\fP\&. 
.TP
\f(BIALPM_PKG_FROM_LOCALDB \fP
From the local database\&. 
.TP
\f(BIALPM_PKG_FROM_SYNCDB \fP
From a sync database\&. 
.SS "enum \fBalpm_pkgreason_t\fP"

.PP
Package install reasons\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BIALPM_PKG_REASON_EXPLICIT \fP
Explicitly requested by the user\&. 
.TP
\f(BIALPM_PKG_REASON_DEPEND \fP
Installed as a dependency for another package\&. 
.TP
\f(BIALPM_PKG_REASON_UNKNOWN \fP
Failed parsing of local database\&. 
.SS "enum \fBalpm_pkgvalidation_t\fP"

.PP
Method used to validate a package\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BIALPM_PKG_VALIDATION_UNKNOWN \fP
The package's validation type is unknown\&. 
.TP
\f(BIALPM_PKG_VALIDATION_NONE \fP
The package does not have any validation\&. 
.TP
\f(BIALPM_PKG_VALIDATION_MD5SUM \fP
The package is validated with md5\&. 
.TP
\f(BIALPM_PKG_VALIDATION_SHA256SUM \fP
The package is validated with sha256\&. 
.TP
\f(BIALPM_PKG_VALIDATION_SIGNATURE \fP
The package is validated with a PGP signature\&. 
.SH "Function Documentation"
.PP 
.SS "int alpm_fetch_pkgurl (\fBalpm_handle_t\fP * handle, const \fBalpm_list_t\fP * urls, \fBalpm_list_t\fP ** fetched)"

.PP
Fetch a list of remote packages\&. 
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle 
.br
\fIurls\fP list of package URLs to download 
.br
\fIfetched\fP list of filepaths to the fetched packages, each item corresponds to one in \fRurls\fP list\&. This is an output parameter, the caller should provide a pointer to an empty list (*fetched === NULL) and the callee fills the list with data\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success or -1 on failure 
.RE
.PP

.SS "int alpm_pkg_changelog_close (const \fBalpm_pkg_t\fP * pkg, void * fp)"

.PP
Close a package changelog for reading\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to close the changelog of (either file or db) 
.br
\fIfp\fP the 'file stream' to the package changelog to close 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error 
.RE
.PP

.SS "void * alpm_pkg_changelog_open (\fBalpm_pkg_t\fP * pkg)"

.PP
Open a package changelog for reading\&. Similar to fopen in functionality, except that the returned 'file stream' could really be from an archive as well as from the database\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to read the changelog of (either file or db) 
.RE
.PP
\fBReturns\fP
.RS 4
a 'file stream' to the package changelog 
.RE
.PP

.SS "size_t alpm_pkg_changelog_read (void * ptr, size_t size, const \fBalpm_pkg_t\fP * pkg, void * fp)"

.PP
Read data from an open changelog 'file stream'\&. Similar to fread in functionality, this function takes a buffer and amount of data to read\&. If an error occurs pm_errno will be set\&. 
.PP
\fBParameters\fP
.RS 4
\fIptr\fP a buffer to fill with raw changelog data 
.br
\fIsize\fP the size of the buffer 
.br
\fIpkg\fP the package that the changelog is being read from 
.br
\fIfp\fP a 'file stream' to the package changelog 
.RE
.PP
\fBReturns\fP
.RS 4
the number of characters read, or 0 if there is no more data or an error occurred\&. 
.RE
.PP

.SS "int alpm_pkg_checkmd5sum (\fBalpm_pkg_t\fP * pkg)"

.PP
Check the integrity (with md5) of a package from the sync cache\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP package pointer 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly) 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_compute_optionalfor (\fBalpm_pkg_t\fP * pkg)"

.PP
Computes the list of packages optionally requiring a given package\&. The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a package 
.RE
.PP
\fBReturns\fP
.RS 4
the list of packages optionally requiring pkg 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_compute_requiredby (\fBalpm_pkg_t\fP * pkg)"

.PP
Computes the list of packages requiring a given package\&. The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a package 
.RE
.PP
\fBReturns\fP
.RS 4
the list of packages requiring pkg 
.RE
.PP

.SS "off_t alpm_pkg_download_size (\fBalpm_pkg_t\fP * newpkg)"

.PP
Returns the size of the files that will be downloaded to install a package\&. 
.PP
\fBParameters\fP
.RS 4
\fInewpkg\fP the new package to upgrade to 
.RE
.PP
\fBReturns\fP
.RS 4
the size of the download 
.RE
.PP

.SS "\fBalpm_pkg_t\fP * alpm_pkg_find (\fBalpm_list_t\fP * haystack, const char * needle)"

.PP
Find a package in a list by name\&. 
.PP
\fBParameters\fP
.RS 4
\fIhaystack\fP a list of alpm_pkg_t 
.br
\fIneedle\fP the package name 
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the package if found or NULL 
.RE
.PP

.SS "int alpm_pkg_free (\fBalpm_pkg_t\fP * pkg)"

.PP
Free a package\&. Only packages loaded with \fBalpm_pkg_load\fP can be freed\&. Packages from databases will be freed by libalpm when they are unregistered\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP package pointer to free 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly) 
.RE
.PP

.SS "const char * alpm_pkg_get_arch (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the architecture for which the package was built\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_backup (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of files backed up when installing pkg\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to a list of \fBalpm_backup_t\fP objects 
.RE
.PP

.SS "const char * alpm_pkg_get_base (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package base name\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "const char * alpm_pkg_get_base64_sig (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the base64 encoded package signature\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_time_t\fP alpm_pkg_get_builddate (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the build timestamp of the package\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
the timestamp of the build time 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_checkdepends (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns a list of package check dependencies\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_conflicts (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of packages conflicting with pkg\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "\fBalpm_db_t\fP * alpm_pkg_get_db (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the database containing pkg\&. Returns a pointer to the alpm_db_t structure the package is originating from, or NULL if the package was loaded from a file\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the DB containing pkg, or NULL\&. 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_depends (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of package dependencies as \fBalpm_depend_t\fP\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "const char * alpm_pkg_get_desc (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package description\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "const char * alpm_pkg_get_filename (\fBalpm_pkg_t\fP * pkg)"

.PP
Gets the name of the file from which the package was loaded\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_filelist_t\fP * alpm_pkg_get_files (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of files installed by pkg\&. The filenames are relative to the install root, and do not include leading slashes\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to a filelist object containing a count and an array of package file objects 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_groups (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of package groups\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to an internal list of strings\&. 
.RE
.PP

.SS "\fBalpm_handle_t\fP * alpm_pkg_get_handle (\fBalpm_pkg_t\fP * pkg)"

.PP
Gets the handle of a package\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
the alpm handle that the package belongs to 
.RE
.PP

.SS "\fBalpm_time_t\fP alpm_pkg_get_installdate (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the install timestamp of the package\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
the timestamp of the install time 
.RE
.PP

.SS "off_t alpm_pkg_get_isize (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the installed size of the package\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
the total size of files installed by the package\&. 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_licenses (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of package licenses\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to an internal list of strings\&. 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_makedepends (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns a list of package make dependencies\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "const char * alpm_pkg_get_md5sum (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package's MD5 checksum as a string\&. The returned string is a sequence of 32 lowercase hexadecimal digits\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "const char * alpm_pkg_get_name (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package name\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_optdepends (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of package optional dependencies\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "\fBalpm_pkgfrom_t\fP alpm_pkg_get_origin (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the origin of the package\&. 
.PP
\fBReturns\fP
.RS 4
an alpm_pkgfrom_t constant, -1 on error 
.RE
.PP

.SS "const char * alpm_pkg_get_packager (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the packager's name\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_provides (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of packages provided by pkg\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "\fBalpm_pkgreason_t\fP alpm_pkg_get_reason (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package installation reason\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
an enum member giving the install reason\&. 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_replaces (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the list of packages to be replaced by pkg\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&. 
.RE
.PP

.SS "const char * alpm_pkg_get_sha256sum (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package's SHA256 checksum as a string\&. The returned string is a sequence of 64 lowercase hexadecimal digits\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "int alpm_pkg_get_sig (\fBalpm_pkg_t\fP * pkg, unsigned char ** sig, size_t * sig_len)"

.PP
Extracts package signature either from embedded package signature or if it is absent then reads data from detached signature file\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package\&. 
.br
\fIsig\fP output parameter for signature data\&. Callee function allocates a buffer needed for the signature data\&. Caller is responsible for freeing this buffer\&. 
.br
\fIsig_len\fP output parameter for the signature data length\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, negative number on error\&. 
.RE
.PP

.SS "off_t alpm_pkg_get_size (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the size of the package\&. This is only available for sync database packages and package files, not those loaded from the local database\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
the size of the package in bytes\&. 
.RE
.PP

.SS "const char * alpm_pkg_get_url (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package URL\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "int alpm_pkg_get_validation (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the method used to validate a package during install\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
an enum member giving the validation method 
.RE
.PP

.SS "const char * alpm_pkg_get_version (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns the package version as a string\&. This includes all available epoch, version, and pkgrel components\&. Use \fBalpm_pkg_vercmp()\fP to compare version strings if necessary\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string 
.RE
.PP

.SS "\fBalpm_list_t\fP * alpm_pkg_get_xdata (\fBalpm_pkg_t\fP * pkg)"

.PP
Gets the extended data field of a package\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package 
.RE
.PP
\fBReturns\fP
.RS 4
a reference to a list of \fBalpm_pkg_xdata_t\fP objects 
.RE
.PP

.SS "int alpm_pkg_has_scriptlet (\fBalpm_pkg_t\fP * pkg)"

.PP
Returns whether the package has an install scriptlet\&. 
.PP
\fBReturns\fP
.RS 4
0 if FALSE, TRUE otherwise 
.RE
.PP

.SS "int alpm_pkg_load (\fBalpm_handle_t\fP * handle, const char * filename, int full, int level, \fBalpm_pkg_t\fP ** pkg)"

.PP
Create a package from a file\&. If full is false, the archive is read only until all necessary metadata is found\&. If it is true, the entire archive is read, which serves as a verification of integrity and the filelist can be created\&. The allocated structure should be freed using \fBalpm_pkg_free()\fP\&. 
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle 
.br
\fIfilename\fP location of the package tarball 
.br
\fIfull\fP whether to stop the load after metadata is read or continue through the full archive 
.br
\fIlevel\fP what level of package signature checking to perform on the package; note that this must be a '\&.sig' file type verification 
.br
\fIpkg\fP address of the package pointer 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly) 
.RE
.PP

.SS "int alpm_pkg_mtree_close (const \fBalpm_pkg_t\fP * pkg, struct archive * archive)"

.PP
Close a package mtree file\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the local package to close the mtree of 
.br
\fIarchive\fP the archive to close 
.RE
.PP

.SS "int alpm_pkg_mtree_next (const \fBalpm_pkg_t\fP * pkg, struct archive * archive, struct archive_entry ** entry)"

.PP
Read next entry from a package mtree file\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package that the mtree file is being read from 
.br
\fIarchive\fP the archive structure reading from the mtree file 
.br
\fIentry\fP an archive_entry to store the entry header information 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, 1 if end of archive is reached, -1 otherwise\&. 
.RE
.PP

.SS "struct archive * alpm_pkg_mtree_open (\fBalpm_pkg_t\fP * pkg)"

.PP
Open a package mtree file for reading\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the local package to read the mtree of 
.RE
.PP
\fBReturns\fP
.RS 4
an archive structure for the package mtree file 
.RE
.PP

.SS "int alpm_pkg_set_reason (\fBalpm_pkg_t\fP * pkg, \fBalpm_pkgreason_t\fP reason)"

.PP
Set install reason for a package in the local database\&. The provided package object must be from the local database or this method will fail\&. The write to the local database is performed immediately\&. 
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to update 
.br
\fIreason\fP the new install reason 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly) 
.RE
.PP

.SS "int alpm_pkg_should_ignore (\fBalpm_handle_t\fP * handle, \fBalpm_pkg_t\fP * pkg)"

.PP
Test if a package should be ignored\&. Checks if the package is ignored via IgnorePkg, or if the package is in a group ignored via IgnoreGroup\&. 
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle 
.br
\fIpkg\fP the package to test 
.RE
.PP
\fBReturns\fP
.RS 4
1 if the package should be ignored, 0 otherwise 
.RE
.PP

.SS "int alpm_pkg_vercmp (const char * a, const char * b)"

.PP
Compare two version strings and determine which one is 'newer'\&. Returns a value comparable to the way strcmp works\&. Returns 1 if a is newer than b, 0 if a and b are the same version, or -1 if b is newer than a\&.

.PP
Different epoch values for version strings will override any further comparison\&. If no epoch is provided, 0 is assumed\&.

.PP
Keep in mind that the pkgrel is only compared if it is available on both versions handed to this function\&. For example, comparing 1\&.5-1 and 1\&.5 will yield 0; comparing 1\&.5-1 and 1\&.5-2 will yield -1 as expected\&. This is mainly for supporting versioned dependencies that do not include the pkgrel\&. 
.SH "Author"
.PP 
Generated automatically by Doxygen for libalpm from the source code\&.
